import baseOpts from "./baseOpts";
import { randomColor } from "@/utils/index";

// 地图数据
export const mapOpts = baseOpts();
delete mapOpts.xAxis;
delete mapOpts.yAxis;
mapOpts.title.text = "中国地图";
mapOpts.legend.data = ["地区"];
mapOpts.series = [
  {
    name: "地区",
    type: "effectScatter",
    coordinateSystem: "geo",
    data: [],
    symbolSize: 10,
    showEffectOn: "render",
    rippleEffect: {
      brushType: "stroke",
      period: 2,
      scale: 4,
    },
    hoverAnimation: true,
    label: {
      normal: {
        formatter: "{b}",
        position: "right",
        show: true,
      },
      emphasis: {
        show: true,
      },
    },
    itemStyle: {
      normal: {
        color: "#f4e925",
        shadowBlur: 10,
        shadowColor: "#333",
      },
      emphasis: {
        borderColor: "#fff",
        borderWidth: 1,
      },
    },
    zlevel: 0,
  },
];
mapOpts.roam = true;
mapOpts.geo = {
  map: "china",
  label: {
    emphasis: {
      show: true,
      color: "#ee1758",
    },
  },
  zoom: 1.5,
  scaleLimit: {
    min: 1.2,
  },
  itemStyle: {
    normal: {
      areaColor: "#387ba7",
      borderColor: "#282F3C",
    },
    emphasis: {
      areaColor: "#26ddd6",
    },
  },
  regions: [
    {
      name: "河北",
      cp: [115.4004, 39.4688],
      itemStyle: {
        normal: {
          areaColor: "#2b97df",
        },
      },
    },
    {
      name: "江西",
      cp: [116.0156, 27.29],
      itemStyle: {
        normal: {
          areaColor: "#2b97df",
        },
      },
    },
    {
      name: "河南",
      cp: [113.0668, 33.8818],
      itemStyle: {
        normal: {
          areaColor: "#0d4369",
        },
      },
    },
    {
      name: "宁夏",
      cp: [105.9961, 37.3096],
      itemStyle: {
        normal: {
          areaColor: "#0d4369",
        },
      },
    },
    {
      name: "北京",
      cp: [116.4551, 40.2539],
      itemStyle: {
        normal: {
          areaColor: "#3497df",
        },
      },
    },
    {
      name: "香港",
      cp: [114.1178, 22.3242],
      itemStyle: {
        normal: {
          areaColor: "#3497df",
        },
      },
    },
    {
      name: "天津",
      cp: [117.4219, 39.4189],
      itemStyle: {
        normal: {
          areaColor: "#0d4369",
        },
      },
    },
    {
      name: "山西",
      cp: [112.4121, 37.6611],
      itemStyle: {
        normal: {
          areaColor: "#005c9b",
        },
      },
    },
    {
      name: "安徽",
      cp: [117.2461, 32.0361],
      itemStyle: {
        normal: {
          areaColor: "#005c9b",
        },
      },
    },
    {
      name: "台湾",
      cp: [120.0254, 23.5986],
      itemStyle: {
        normal: {
          areaColor: "#005c9b",
        },
      },
    },
    {
      name: "陕西",
      cp: [109.5996, 35.7396],
      itemStyle: {
        normal: {
          areaColor: "#2b97df",
        },
      },
    },
    {
      name: "山东",
      cp: [118.7402, 36.4307],
      itemStyle: {
        normal: {
          areaColor: "#2b97df",
        },
      },
    },
    {
      name: "江苏",
      cp: [118.8586, 32.915],
      itemStyle: {
        normal: {
          areaColor: "#005c9b",
        },
      },
    },
    {
      name: "重庆",
      cp: [107.7539, 30.1904],
      itemStyle: {
        normal: {
          areaColor: "#005c9b",
        },
      },
    },
    {
      name: "湖南",
      cp: [111.5332, 27.3779],
      itemStyle: {
        normal: {
          areaColor: "#0d4369",
        },
      },
    },
    {
      name: "福建",
      cp: [118.3008, 25.9277],
      itemStyle: {
        normal: {
          areaColor: "#0d4369",
        },
      },
    },
    {
      name: "湖北",
      cp: [112.2363, 31.1572],
      itemStyle: {
        normal: {
          areaColor: "#005c9b",
        },
      },
    },
    {
      name: "海南",
      cp: [109.9512, 19.2041],
      itemStyle: {
        normal: {
          areaColor: "#005c9b",
        },
      },
    },
    {
      name: "吉林",
      cp: [125.7746, 43.5938],
      itemStyle: {
        normal: {
          areaColor: "#2b97df",
        },
      },
    },
    {
      name: "贵州",
      cp: [106.6113, 26.9385],
      itemStyle: {
        normal: {
          areaColor: "#2b97df",
        },
      },
    },
    {
      name: "辽宁",
      cp: [122.0438, 41.0889],
      itemStyle: {
        normal: {
          areaColor: "#2b97df",
        },
      },
    },
    {
      name: "新疆",
      cp: [84.9023, 42.148],
      itemStyle: {
        normal: {
          areaColor: "#0d4369",
        },
      },
    },
    {
      name: "澳门",
      cp: [111.5547, 22.1484],
      itemStyle: {
        normal: {
          areaColor: "#0d4369",
        },
      },
    },
    {
      name: "上海",
      cp: [121.4648, 31.2891],
      itemStyle: {
        normal: {
          areaColor: "#0d4369",
        },
      },
    },
    {
      name: "西藏",
      cp: [87.8695, 31.6846],
      itemStyle: {
        normal: {
          areaColor: "#005c9b",
        },
      },
    },
    {
      name: "内蒙古",
      cp: [112.5977, 46.3408],
      itemStyle: {
        normal: {
          areaColor: "#005c9b",
        },
      },
    },
    {
      name: "浙江",
      cp: [120.498, 29.0918],
      itemStyle: {
        normal: {
          areaColor: "#005c9b",
        },
      },
    },
    {
      name: "青海",
      cp: [95.2402, 35.4199],
      itemStyle: {
        normal: {
          areaColor: "#2b97df",
        },
      },
    },
    {
      name: "四川",
      cp: [101.9199, 30.1904],
      itemStyle: {
        normal: {
          areaColor: "#005c9b",
        },
      },
    },
    {
      name: "黑龙江",
      cp: [126.1445, 48.7156],
      itemStyle: {
        normal: {
          areaColor: "#2b97df",
        },
      },
    },
    {
      name: "甘肃",
      cp: [99.7129, 38.166],
      itemStyle: {
        normal: {
          areaColor: "#2b97df",
        },
      },
    },
    {
      name: "云南",
      cp: [101.0652, 25.1807],
      itemStyle: {
        normal: {
          areaColor: "#2b97df",
        },
      },
    },
    {
      name: "广西",
      cp: [107.7813, 23.6426],
      itemStyle: {
        normal: {
          areaColor: "#2b97df",
        },
      },
    },
    {
      name: "广东",
      cp: [113.4668, 22.8076],
      itemStyle: {
        normal: {
          areaColor: "#2b97df",
        },
      },
    },
  ],
};

// 种植品种
export const cropvarOpts = baseOpts();
delete cropvarOpts.xAxis;
delete cropvarOpts.yAxis;
cropvarOpts.series = [
  {
    type: "pie",
    radius: "50%",
    data: [],
    emphasis: {
      itemStyle: {
        shadowBlur: 10,
        shadowOffsetX: 0,
        shadowColor: "rgba(0, 0, 0, 0.5)",
      },
    },
  },
];

// 消息统计
export const msgOpts = baseOpts();
msgOpts.series = [
  {
    data: [],
    type: "bar",
    showBackground: true,
    itemStyle: {
      normal: {
        color: function () {
          return randomColor();
        },
      },
    },
  },
];

// 警告
export const warningOpts = baseOpts();
warningOpts.series = [
  {
    data: [],
    type: "bar",
    showBackground: true,
    itemStyle: {
      normal: {
        color: function () {
          return (
            "#" + Math.floor(Math.random() * (256 * 256 * 256 - 1)).toString(16)
          );
        },
      },
    },
  },
];

// 多折线图
export const sensorOpts = baseOpts();
sensorOpts.xAxis.axisLabel.rotate = 30;
